from core.basehandler import BaseHandler
from core.room import Room
from core.action import Action
from core.support import get_game
import logging
from items.bacardi151 import Bacardi151
from items.earing import Earing
from items.kahlua import kahlua
from items.fiftyshades import Fiftyshades
from items.mirror import mirror 
from items.rations import rations
from items.sunglasses import Sunglasses
from items.waterjug import Waterjug

class StartVilla(Room):
    def __init__(self, room_id):
        Room.__init__(self, room_id)    # do basic initialization for every room
        #add inventory items
        self.add_item(Fiftyshades())
        self.add_item(Bacardi151())
        self.add_item(Earing())
        self.add_item(kahlua())
        #self.add_item(Kite())
        #self.add_item(Knife())
        #self.add_item(Lighter())
        self.add_item(mirror())
        self.add_item(rations())
        self.add_item(Sunglasses())
        self.add_item(Waterjug())
        # build list of actions
        self.add_action(GoToSea)
        #self.add_action(Down)
    
        
    # return description of room.
    def get_description(self):
        #return "The sun is high and the seas are calm. You look out from your beachside villa at the waves lapping at the shore. Despite the demands on a Fortune 500 CEO, today is a good day for a sail. There is no time to make multiple trips between the villa and the boathouse and you can only carry six items. You'll only be gone a few hours, how much do you really need? "
        #return "The sun is high and the seas are calm. " + self.game.get_player().getPlayerName() + " looks out from " + self.game.get_player().getPlayerPosessionPronoun() + " beachside villa at the waves lapping at the shore. Despite the demands on a Fortune 500 CEO, today is a good day for a sail. There is no time to make multiple trips between the villa and the boathouse and you can only carry six items. You'll only be gone a few hours, how much do you really need? "
        logging.info('get_description in StartVilla called')
        game = get_game()
        player = game.get_player()
        playerName = player.getPlayerName()
        playerPosessionPronoun = player.getPlayerPosessionPronoun()
        logging.info("playerName is: " + playerName)
        logging.info("playerPosessionPronoun is: " + playerPosessionPronoun)
        #description = "The sun is high and the seas are calm. " + playerName + " looks out from " + playerPosessionPronoun + " beachside villa at the waves lapping at the shore. Despite the demands on a Fortune 500 CEO, today is a good day for a sail. There is no time to make multiple trips between the villa and the boathouse and you can only carry four items. You'll only be gone a few hours, how much do you really need? "
        description = "The sun is high and the seas are calm. You look out from your beachside villa at the waves lapping at the shore. Despite the demands on a Fortune 500 CEO, today is a good day for a sail. There is no time to make multiple trips between the villa and the boathouse and you can only carry four items. You'll only be gone a few hours, how much do you really need? Select up to four items and click Go to Sea."
        return description
        
    # return image of room
    def get_image(self):
        return 'startvilla_pic.jpg'

class StartVillaHandler(BaseHandler):
    
    # return class to use to create a new instance of this room
    def get_room_class(self):
        return StartVilla    
    
# define actions for this room

class GoToSea(Action):
    def __init__(self):
        Action.__init__(self, "GoToSea")    # do basic initialization for every action
    
    # return description of action (used in label on webpage)
    def get_description(self):
        return "Go To Sea"
    
    # return id of room to enter when action is complete
    def get_destination(self):
        return 'sea1'
    
    # return http method to use when user clicks on this action
    # use "get" if just moving to another room.  if changing something
    # like the state of an inventory item or room then use "post"
    def get_method(self):
        return "get"

